<?php

/**
 * CredentialTasks filter form base class.
 *
 * @package    maximous
 * @subpackage filter
 * @author     Mina.Gerges.Wadea
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCredentialTasksFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'credential_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Credential'), 'add_empty' => true)),
      'site_component_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SiteComponent'), 'add_empty' => true)),
      'add_credential'           => new sfWidgetFormFilterInput(),
      'edit_credential'          => new sfWidgetFormFilterInput(),
      'delete_credential'        => new sfWidgetFormFilterInput(),
      'check_credential'         => new sfWidgetFormFilterInput(),
      'change_status_credential' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'credential_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Credential'), 'column' => 'id')),
      'site_component_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('SiteComponent'), 'column' => 'id')),
      'add_credential'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'edit_credential'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'delete_credential'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'check_credential'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'change_status_credential' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('credential_tasks_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'CredentialTasks';
  }

  public function getFields()
  {
    return array(
      'id'                       => 'Number',
      'credential_id'            => 'ForeignKey',
      'site_component_id'        => 'ForeignKey',
      'add_credential'           => 'Number',
      'edit_credential'          => 'Number',
      'delete_credential'        => 'Number',
      'check_credential'         => 'Number',
      'change_status_credential' => 'Number',
    );
  }
}
